import axios from "axios";//创建一个axios的对象
import { useRouter } from "vue-router";
import { inject } from "vue";
//生成一个axios的实例
const http=axios.create({
	baseURL:"https://calcbox.seakoi.net",// baseURL会在发送请求的时候拼接在url参数前面
	timeout:60000,//请求超时
});
// http.defaults.headers['api_token'] = localStorage.getItem('token') || '' //在请求头中传入token
 
http.interceptors.request.use(config => { 
    // console.log(config,'请求拦截');
 
  return config;
}, err => { 
  return Promise.reject(err)
})
 
 
//响应拦截器
http.interceptors.response.use(response => {
	
	//console.log(response,'响应拦截');
	return response;
  
  }, err => { 
	
	return Promise.reject(err)
  })
 
export default http;//导出